#include <iostream>
#include <vector>
using namespace std;
vector<int> a;
int main() {
    int n, m;
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        a.push_back(i);
    }
    int i = 0;
    int ret = 0;
    int k = 0;
    while(1) {
        if(a[i % n] != -1) {
            ret++;
            if(ret == m) {
                cout << a[i % n] << " ";
                k++;
                if(k == n) {
                    break;
                }
                a[i % n] = -1;
                ret = 0;
            }
        }
        i++;
    }
    return 0;
}